#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timerid = this->startTimer(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::timerEvent(QTimerEvent *event)
{
    if(event->timerId() == this->timerid)
    {
        ui->lcdNumber->display(ui->lcdNumber->value() - 1);
        if(ui->lcdNumber->value() == 0)
        {
            this->killTimer(this->timerid);
            this->close();
        }
    }
    else
        return;

}

